package org.example2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserService {

    @Autowired
    private UserDao userDao;

//    @Autowired
    public UserService() {
        System.out.println("UserService的无参构造执行了");
    }

    @Autowired
    public UserService(UserDao userDao) {
        System.out.println("UserService的有参构造执行了");
        this.userDao = userDao;
    }

    @Autowired
    public void autowiredMethod(UserDao userDao) {
        System.out.println("autowiredMethod有参方法执行了------userDao:"+userDao);

    }

    @Autowired
    public void autowiredMethod() {
        System.out.println("autowiredMethod无参方法执行了");
    }

    public void query() {
        System.out.println("UserService中的query执行了");
        this.userDao.query();
    }


}
